package com.smarttiger.zero.admin.webservice;

import com.smarttiger.zero.admin.util.SpringContextUtils;

import javax.jws.WebMethod;
import javax.jws.WebService;
import java.util.ArrayList;

@WebService(name = "zeroservice",serviceName="AppService")
public class AppService {

    private String code;


    /* 动态生成代码
    @WebResult(name = "result")
    @WebMethod
    public String api(@WebParam(name = "token") String token,
                      @WebParam(name = "filter") String filter){
        icode = "PEM";
        return execute(icode,token,argsList);
    }
    */

    @WebMethod(exclude = true)
    public String execute(Object[] args){
        ArrayList<Object> argsList = new ArrayList<>();
        String code = args[0].toString();
        String token = args[1].toString();
        for (int i = 2; i < args.length; i++) {
            argsList.add(args[i]);
        }
        AppServiceSpring appServiceSpring = SpringContextUtils.getBean("appServiceSpring", AppServiceSpring.class);
        return appServiceSpring.api(code,token,argsList);
    }
}